#!/usr/bin/python
# -*-coding:UTF-8 -*-

# ========================
# @Time  : 2021/3/9
# @Author: Sunny
# ========================

#原理与线程池一致


import os
import time
from concurrent.futures import ProcessPoolExecutor


def work(name, age):
    for i in range(3):
        time.sleep(1)
        print(f'{name}:--{age}------work{i}----------')



def main():
    with ProcessPoolExecutor(max_workers=5) as ts:
        ts.submit(work, 'musen', 18)
        ts.submit(work, 'musen', 19)
        ts.submit(work, 'musen', 20)
        ts.submit(work, 'musen', 21)
        ts.submit(work, 'musen', 22)
        ts.submit(work, 'musen', 23)
        ts.submit(work, 'musen', 24)
        ts.submit(work, 'musen', 25)

if __name__ == '__main__':
    main()